From 49d6f8401bf93c7a5ac411db31d7a84a77df66b4 Mon Sep 17 00:00:00 2001 From: Tim Deegan Date: Thu, 8 Feb 2007 10:44:53 +0000 Subject: [PATCH] [XEN] When removing pages, drop shadow refs before complaining about refcount. Signed-off-by: Tim Deegan --- xen/common/memory.c | 10 ++++++---- xen/include/asm-x86/shadow.h | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/xen/common/memory.c b/xen/common/memory.c index 78887e19a6..fcd483818d 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -175,11 +175,13 @@ int guest_remove_page(struct domain *d, unsigned long gmfn) if ( unlikely(!page_is_removable(page)) ) { + shadow_drop_references(d, page); /* We'll make this a guest-visible error in future, so take heed! */ - gdprintk(XENLOG_INFO, "Dom%d freeing in-use page %lx (pseudophys %lx):" - " count=%lx type=%lx\n", - d->domain_id, mfn, get_gpfn_from_mfn(mfn), - (unsigned long)page->count_info, page->u.inuse.type_info); + if ( !page_is_removable(page) ) + gdprintk(XENLOG_INFO, "Dom%d freeing in-use page %lx " + "(pseudophys %lx): count=%lx type=%lx\n", + d->domain_id, mfn, get_gpfn_from_mfn(mfn), + (unsigned long)page->count_info, page->u.inuse.type_info); } guest_physmap_remove_page(d, gmfn, mfn); diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h index 2afc0b0562..a4a489dcf5 100644 --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -355,8 +355,9 @@ int sh_remove_all_mappings(struct vcpu *v, mfn_t target_mfn); static inline void shadow_drop_references(struct domain *d, struct page_info *p) { - /* See the comment about locking in sh_remove_all_mappings */ - sh_remove_all_mappings(d->vcpu[0], _mfn(page_to_mfn(p))); + if ( unlikely(shadow_mode_enabled(d)) ) + /* See the comment about locking in sh_remove_all_mappings */ + sh_remove_all_mappings(d->vcpu[0], _mfn(page_to_mfn(p))); } /* Remove all shadows of the guest mfn. */ -- 2.30.2